<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use App\Models\Project;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Log;
use Illuminate\Support\Facades\DB;

class ProjectUser extends Model
{
    protected $table = 'xfy_project_users';

    // public function user(){
    //  return $this->belongsTo(User::class,'user_id','id');
    // }
    public function projectId():BelongsToMany
    {
        return $this->belongsToMany(Project::class,'xfy_project_users','projectId','user_id')->withTimestamps();
    }

    // public function getProjectIdAttribute($value)
    // {
    //     $res = Db::table('xfy_project')->where(['projectId'=>$value])->get()->toArray();
    //     return $res;
    // }
}